const cinemaModel = require('../dao/models/cinemaModel');

module.exports.addCinema = async (params) => {
   const result = cinemaModel.create(params)
   if(result) {
    return {
        code :1,
        message :'电影数据新增成功'
    }   
   }
   return {
       code:0,
       message:'电影数据新增失败'
   }
}

module.exports.getCinema = async () => {
    const data = await cinemaModel.find()
    return {
        code:1,
        message :'影院数据获取成功',
        data
    }
}

module.exports.deleteCinema = async (data) => {
    const result = await cinemaModel.deleteOne(data)
    return {
        code:1,
        message :'删除成功啊丢',
    }
}

module.exports.updateCinema = async (params) => {
    console.log(params);
    const result = await cinemaModel.updateOne({_id:params._id},params)
    if (result.modifiedCount ===1){
        return {
            code:1,
            message:'电影类型修改成功'
        }

    }
    return {
        code:0,
        message:'电影类型修改失败，带废物一个'
    }
}